package com.dingyh.shopwebbackground.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        //上传的图片在D盘下的GraduatioProject/shopWeb-background/src/main/webapp/upload_images/，
        // 访问路径例子:http://localhost:8090/dyh/upload_images/business/1.jpg
        registry.addResourceHandler("/upload_images/**").addResourceLocations("file:D:/GraduatioProject/shopWeb-background/src/main/webapp/upload_images/");
//        registry.addResourceHandler("/upload_images/**").addResourceLocations("file:D:/GraduatioProject/shopWeb-background/src/main/webapp/upload_images/commodity/");
//        registry.addResourceHandler("/upload_images/**").addResourceLocations("file:D:/GraduatioProject/shopWeb-background/src/main/webapp/upload_images/user/");
        //file:D:/GraduatioProject/shopWeb-background/src/main/webapp/upload_images/指向本地图片路径地址
        super.addResourceHandlers(registry);
    }
}
